package com.jeesite.modules.kj.api.vo.response;

import com.jeesite.modules.kj.api.vo.response.base.BaseResponseVo;
import com.jeesite.modules.kj.entity.KjMember;
import com.jeesite.modules.kj.entity.KjMemberIntegrals;
import com.jeesite.modules.kj.entity.KjProjectTeam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.math.BigDecimal;

@Data
public class TeamResponseVo extends BaseResponseVo<KjProjectTeam> {

    @ApiModelProperty(value = "ID")
    private String id;

    @ApiModelProperty(value = "团队名")
    private String name;		// 团队名
    @ApiModelProperty(value = "团队组织者名")
    private String leader;		// 团队组织者名
    @ApiModelProperty(value = "团队组织者ID")
    private String leaderId;		// 团队组织者ID
    @ApiModelProperty(value = "团队头像")
    private String headimg;		// 头像
    @ApiModelProperty(value = "项目ID")
    private String projectId;		// 项目ID
    @ApiModelProperty(value = "项目名")
    private String projectName;		// 项目名
    @ApiModelProperty(value = "目标积分")
    private BigDecimal targetIntegrals;		// 目标积分
    @ApiModelProperty(value = "已捐赠积分")
    private BigDecimal contribute;		// 已捐赠积分
    @ApiModelProperty(value = "限制人数")
    private Long limitNum;		// 限制人数
    @ApiModelProperty(value = "已参加人数")
    private Long attentionNum;		// 已参加人数

    public TeamResponseVo() {
    }

    @Override
    public void setEntity(KjProjectTeam entity) {
        BeanUtils.copyProperties(entity, this);
        this.headimg = entity.getKjMember().getHeadimg();
        this.leader = entity.getKjMember().getName();
        if(this.contribute == null){
            this.contribute = BigDecimal.ZERO;
        }
    }

    public TeamResponseVo(KjProjectTeam entity) {
        setEntity(entity);
    }
}
